#include <algorithm>
#include <cstdint>
#include <iostream>
#include <istream>
using ll = int64_t;

ll a[3];

static inline ll check(ll n){
    if(n<0)return false;
    for(ll i=0;i<3;i++){
        if(a[i]<n+i)return 0;
    }
    return n*3+3;
}

int main(){
    std::iostream::sync_with_stdio(false);
    std::cin.tie(nullptr);

    for(int i=0;i<3;i++)std::cin>>a[i];
    std::cout<<std::max({check(a[0]),check(a[1]-1),check(a[2]-2)})<<"\n";
}